package com.stgy.lease.web.admin.controller.appointment;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.stgy.lease.common.result.Result;
import com.stgy.lease.model.domain.LeaseAgreement;
import com.stgy.lease.web.admin.dto.AppointmentSearchDto;
import com.stgy.lease.web.admin.service.LeaseAgreementService;
import com.stgy.lease.web.admin.service.ViewAppointmentService;
import com.stgy.lease.web.admin.vo.AppointmentInfoVo;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * ClassName:AppointmentController
 * Package:com.stgy.lease.web.admin.controller.appointment
 * Description:
 *
 * @Author:helei
 * @Create:2024/9/2 - 15:57
 */
@RestController
@RequestMapping("/admin/appointment")
@Tag(name = "看房预约管理模块")
public class AppointmentController {

    @Autowired
    private ViewAppointmentService viewAppointmentService;



    @Operation(summary = "条件分页查询看房预约列表")
    @GetMapping("/page")
    public Result<Page<AppointmentInfoVo>> page(AppointmentSearchDto appointmentSearchDto) {
        return Result.ok(viewAppointmentService.pageItem(appointmentSearchDto));
    }

    //http://localhost:5174/admin/appointment/updateStatusById?id=1&status=3 POST
    @Operation(summary = "根据id更新看房预约状态")
    @PostMapping("/updateStatusById")
    public Result<String> updateStatusById(@RequestParam Long id, @RequestParam Integer status) {
        return Result.build(viewAppointmentService.updateStatusById(id, status));
    }

}
